import request from '@/config/axios'

// 客户联系人 VO
export interface CustContactsVO {
  id: number // id
  custId: number // 客户ID
  name: string // 姓名
  sex: string // 性别
  position: string // 职务
  email: string // 邮箱
  landline: string // 座机
  phone: string // 移动电话
  facebook: string // Facebook
  ins: string // ins
  tiktok: string // tiktok
  youtube: string // Youtube
  linkedin: string // Linkedin
  remark: string // 备注
}

// 客户联系人 API
export const CustContactsApi = {
  // 查询客户联系人分页
  getCustContactsPage: async (params: any) => {
    return await request.get({ url: `/business/cust-contacts/page`, params })
  },

  // 查询客户联系人详情
  getCustContacts: async (id: number) => {
    return await request.get({ url: `/business/cust-contacts/get?id=` + id })
  },

  // 根据客户 ID 获取联系人列表
  listByCustId: async (params: { custId: number }) => {
    return await request.get({ 
      url: `/business/cust-contacts/list-by-custId`,
      params: { custId: params.custId } 
    })
  },

  // 新增客户联系人
  createCustContacts: async (data: CustContactsVO) => {
    return await request.post({ url: `/business/cust-contacts/create`, data })
  },

  // 修改客户联系人
  updateCustContacts: async (data: CustContactsVO) => {
    return await request.put({ url: `/business/cust-contacts/update`, data })
  },

  // 删除客户联系人
  deleteCustContacts: async (id: number) => {
    return await request.delete({ url: `/business/cust-contacts/delete?id=` + id })
  },

  // 导出客户联系人 Excel
  exportCustContacts: async (params) => {
    return await request.download({ url: `/business/cust-contacts/export-excel`, params })
  },
}
